const {
  defineConfig
} = require('@vue/cli-service')
const port = process.env.port || process.env.npm_config_port || 9528
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false,
  publicPath: './',
  outputDir: 'aiintract',
  assetsDir: 'static',
  lintOnSave: process.env.ENV === 'development',
  productionSourceMap: false,

  devServer: {
    webSocketServer: false,
    port: port,
    // 跨域
    proxy: {
      // 只要axios请求中带有/api的url,就会触发代理机制
      '/ai': {
        // 目标路径：target(我们要代理请求的地址)
        target: process.env.VUE_APP_BASE_URL,
        // 允许跨域
        changOrigin: true,
        // 重写路径 api代替了目标路径
        pathRewrite: {
          '': ''
        }
      }
    },
  },
})